﻿<controls:ChildWindow x:Class="Candy.MoveFamilyTargetWindow"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
                      xmlns:mvvm="http://www.galasoft.ch/mvvmlight"
                      xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
           Width="400" Height="497" 
           Title="MoveFamilyTargetWindow" Style="{StaticResource ChildWindowStyleChromeless}" DataContext="{Binding MoveToFamily, Mode=OneWay, Source={StaticResource Locator}}">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <mvvm:EventToCommand Command="{Binding Load}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    <Border Margin="2" Background="{StaticResource ControlBackgroundDark}" BorderBrush="{StaticResource Accent}" BorderThickness="1">
        <Grid x:Name="LayoutRoot">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="31*"/>
                <ColumnDefinition Width="2*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition/>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" HorizontalAlignment="Right" Margin="0,8,8,8" Grid.Row="2" Grid.ColumnSpan="2" VerticalAlignment="Bottom" />
            <Button x:Name="OKButton" Content="OK"  Width="75" HorizontalAlignment="Right" Margin="0,12,64,8" Grid.Row="2" VerticalAlignment="Bottom" Command="{Binding Move, Mode=OneWay}" />
            <TextBox Margin="8,8,0,8" TextWrapping="Wrap" Text="{Binding Filter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" HorizontalContentAlignment="Stretch" Height="24"/>
            <ListBox HorizontalAlignment="Left" Height="406" Margin="8,10,0,0" Grid.Row="1" VerticalAlignment="Top" Width="378" ItemsSource="{Binding FamiliesView.View}" Grid.ColumnSpan="2" SelectedItem="{Binding SelectedFamily, Mode=TwoWay}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}"/>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Border>
</controls:ChildWindow>